#ifndef _UTIL_H
#define _UTIL_H

#define delim "\t \r\n"

double getTimeStamp();

#ifdef __CUDACC__

inline void check_cuda_errors(const char *filename, const int line_number)
{
  cudaError_t error = cudaGetLastError();
  if(error != cudaSuccess)
  {
    fprintf(stderr,"CUDA error at %s:%i: %s\n", filename, line_number, cudaGetErrorString(error));
    exit(1);
  }
}

#endif

float * read_raw_matrix(char *filename, int padding_size, int row, int col, int *padded_row);

float* read_matrix(char *filename, int padding_size, int *row, int *col,int *padded_row);

void write_submatrix(float *M,int row, int col,int subrow, int subcol);

void write_matrix(float *M,int row, int col);

#endif
